<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>顶吹炉实时数据</title>
    <link rel="stylesheet" href="../../css/reset.css">
    <link rel="stylesheet" href="../../css/common.css">
<!--    <link rel="stylesheet" href="../../css/swiper.min.css">-->
    <link rel="stylesheet" href="../../css/style.css">
    <style>
      .data_page{
      }
      .box{
        width: 604px;
        color: #ffffff;
        overflow: hidden;
      }
      .item{
        float: left;
        margin-right: 50px;
        width: 111px;
        height: 108px;
        padding-top: 20px;
        background: url("../../img/itemBg.png") no-repeat center center;
        background-position: center bottom;
        background-size: 110px 60px;
      }
      .item:nth-child(4n){
        margin-right: 0;
      }
      .title {
        text-align: center;
        font-size: 16px;
        color: #ffffff;
      }
      .value{
        color: #07ebff;
        font-size: 34px;
        text-align: center;
        font-family: ddinbold;
      }
      .unit{
        font-size: 18px;
      }

    </style>

</head>
<body class="data_page">

<div class="box">

</div>

</body>
<script type="text/javascript" charset="utf-8" src="../../js/jquery-3.1.1.min.js"></script>
<script type="text/javascript" charset="utf-8" src="../../js/common.js"></script>
<script>
$(function (){

  var a = {"code":200,"msg":null,"timestamp":"2021-11-12 15:03:30","data":{"id":"UhtEHfuDVtcD9L4BrM25Lm","code":"jc_equip_data_real_iot","name":"金川实时数据","dataTable":null,"enabled":true,"onlineTimeout":60000,"remark":"","lastModifyDate":1636698461000,"versionId":33,"online":true,"onlineTimestamp":1636700603238000000,"fields":[{"code":"YDH_SV","name":"氧单耗","valueType":"String","valueUnit":"","defaultValue":null,"expectedValue":"","expectedValueMin":0.0,"expectedValueMax":999999.0,"remark":"","value":"82.0","valueTimestamp":1636700602549000000},{"code":"RLGJKLJ_CAL","name":"干精矿班累计","valueType":"String","valueUnit":"","defaultValue":null,"expectedValue":"","expectedValueMin":0.0,"expectedValueMax":0.0,"remark":"","value":"1302.13","valueTimestamp":1636700602631000000},{"code":"RLWLLJ_CAL","name":"物料班累计","valueType":"String","valueUnit":"","defaultValue":null,"expectedValue":"","expectedValueMin":0.0,"expectedValueMax":999999.0,"remark":"","value":"1582.72","valueTimestamp":1636700602710000000},{"code":"AIA60601","name":"精矿含水量","valueType":"String","valueUnit":"","defaultValue":null,"expectedValue":"","expectedValueMin":0.0,"expectedValueMax":999999.0,"remark":"","value":"10.32","valueTimestamp":1636700602796000000},{"code":"ZML_CAL","name":"总煤量","valueType":"String","valueUnit":"","defaultValue":null,"expectedValue":"","expectedValueMin":0.0,"expectedValueMax":9.999999999E9,"remark":"","value":null,"valueTimestamp":0},{"code":"PQFZL","name":"总风量","valueType":"String","valueUnit":"","defaultValue":null,"expectedValue":"","expectedValueMin":0.0,"expectedValueMax":9.9999999E7,"remark":"","value":"52000.0","valueTimestamp":1636700602966000000},{"code":"AIAI707","name":"烟气SO2浓度","valueType":"String","valueUnit":"","defaultValue":null,"expectedValue":"","expectedValueMin":0.0,"expectedValueMax":999999.0,"remark":"","value":"20.09","valueTimestamp":1636700603059000000},{"code":"AIAI706","name":"烟气残氧浓度","valueType":"String","valueUnit":"","defaultValue":null,"expectedValue":"","expectedValueMin":0.0,"expectedValueMax":9999999.0,"remark":"","value":"5.6","valueTimestamp":1636700603148000000},{"code":"ZT1230AB","name":"换枪位","valueType":"String","valueUnit":"","defaultValue":null,"expectedValue":"","expectedValueMin":0.0,"expectedValueMax":9999999.0,"remark":"","value":"1690.87","valueTimestamp":1636700603238000000}],"tags":[]}};

  let html = ``;
  for (let i = 0; i < a.data.fields.length; i++) {
    let ddfi = a.data.fields[i];
    html += `<div class="item">
          <div class="value">${ddfi.value || 0}<span class="unit">${ddfi.valueUnit || ''}</span></div>
          <div class="title">${ddfi.name || ''}</div>
        </div>`
  }
  $('.box').html(html)
  /*getData()
  function getData(){
    $.ajax({
      type: 'GET',
      url: 'http://172.16.3.123:9120/iot/query/device/shadow?product=jc_equip_data_real&device=jc_equip_data_real_iot',
      data: {},
      dataType: 'json',
      success: function (data) {
        let html = ``;
        for (let i = 0; i < data.data.fields.length; i++) {
          let ddfi = data.data.fields[i];
          html += `<div class="item">
          <div class="value">${ddfi.value || 0}<span class="unit">${ddfi.valueUnit || ''}</span></div>
          <div class="title">${ddfi.name || ''}</div>
        </div>`
        }
        $('.box').html(html)
      },
      error: function (msg) {

      }
    });
  }*/
  setInterval(function () {
    getData()
  },60000)

})
</script>
</html>
